import request from '@/utils/request'

// 查询
export function getClassList(data) {
  if (data.grade == '') {
    return request({
      url: `/class/query?name=${data.name}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
  if (data.grade != '') {
    return request({
      url: `/class/query?name=${data.name}&grade=${data.grade}&limit=${data.limit}&page=${data.page}`,
      method: 'get'
    })
  }
}

// 添加
export function addClassList(data) {
  return request({
    url: '/class/insert',
    method: 'post',
    data
  })
}

// 测试作物
export function getcrop() {
  return request({
    url: `/crop/page`,
    method: 'get'
  })
}

// 删除
export function deleteclassList(data) {
  return request({
    url: `/class/delete/${data.classId}`,
    method: 'delete'
  })
}

// 批量删除
export function deleteclassLists(data) {
  return request({
    url: `/class/deletes?ids%5B%5D=${data.item}`,
    method: 'delete'
  })
}

// 更新
export function updateclassList(data) {
  return request({
    url: '/class/update',
    method: 'delete',
    data
  })
}
